namespace PHMEE.PHM.Algorithms.Basic;

/// <summary>
/// 特征值（时域）算法
/// </summary>
public class TrendFeaAlg
{
    private readonly TrendFeaService.TrendFeaServiceClient _client;

    public TrendFeaAlg(TrendFeaService.TrendFeaServiceClient client)
    {
        _client = client;
    }
    
    /// <summary>
    /// 特征值（时域）算法
    /// </summary>
    /// <param name="accData">加速度 振动信号时域序列</param>
    /// <param name="sampleRate">采样频率</param>
    /// <returns></returns>
    public TrendFeaResponse TrendFea(float[] accData, float sampleRate)
    {
        var request = new TrendFeaRequest
        {
            AccData = {accData},
            SampleRate = sampleRate
        };
        
        return _client.TrendFeaAlg(request);
    }
    
    /// <summary>
    /// 特征值（时域）算法
    /// </summary>
    /// <param name="accData">加速度 振动信号时域序列</param>
    /// <param name="sampleRate">采样频率</param>
    /// <returns></returns>
    public async Task<TrendFeaResponse> TrendFeaAsync(float[] accData, float sampleRate)
    {
        var request = new TrendFeaRequest
        {
            AccData = {accData},
            SampleRate = sampleRate
        };
        
        return await _client.TrendFeaAlgAsync(request);
    }
}